def J(x):
    return (x ** 2 - 2) ** 2

def gradient(x):
    return 4 * x**3 - 8 * x

x = 1
learning_rate = 0.1

while (y := J(x)) > 1e-30:
    print(f"x: {x}, J(x): {y}")
    x -= learning_rate * gradient(x)


